package com.ssm.helong.shop.controller;

import com.ssm.helong.shop.service.GoodsAttributeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
@RequestMapping("/GoodsAttribute")
public class GoodsAttributeController {

    @Autowired
    private GoodsAttributeService goodsAttributeService;

    @RequestMapping("updateStock")
    public String updateStock(Integer id) {
        goodsAttributeService.updateStock(id);
        return "";
    }

    @RequestMapping("selectStock")
    public String selectStock(Integer id) {
        goodsAttributeService.selectStock(id);
        return "";
    }

    @RequestMapping("PlaceAnOrder")
    public String PlaceAnOrder(Integer id) {

        int result = goodsAttributeService.updateStock(id);
        if (result <= -1) {
            return "err";
        } else {
            return "sussess";
        }

    }
}
